package com.test.poi;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.util.CellRangeAddress;

public class PioCE {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		 HSSFWorkbook wb = new HSSFWorkbook();

		    // 创建Excel的工作sheet,对应到一个excel文档的tab
		 HSSFSheet sheet = wb.createSheet("sheet1");
		 // 创建Excel的sheet的一行
		    HSSFRow row = sheet.createRow(0);
		    row.setHeight((short) 500);// 设定行的高度
		    // 创建一个Excel的单元格
		    HSSFCell cell = row.createCell(0);
		 // 合并单元格(startRow，endRow，startColumn，endColumn)
//		    sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 2));
		    // 给Excel的单元格设置样式和赋值
		        cell.setCellValue("hello world");
		        HSSFRow row2 = sheet.createRow(1);
		        cell = row2.createCell(0);
		        cell.setCellValue("百度");
		        FileOutputStream os = new FileOutputStream("H:\\lei.xls");
		        wb.write(os);
		        os.close();
		
	
	}


}
